package com.hu.flink12.sensor

import org.apache.flink.api.common.RuntimeExecutionMode
import org.apache.flink.streaming.api.scala._

/**
 * @Author: hujianjun
 * @Create Date: 2021/1/26 16:01
 * @Describe: 从csv文件读取数据
 */

object ReadSensorCSV {
  def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment
    val inputStream = env.readTextFile(getClass.getResource("/data/sensor.csv").getPath, "utf-8")

    inputStream.print().setParallelism(1)

    env.setRuntimeMode(RuntimeExecutionMode.BATCH)
    env.execute("读取传感器csv数据")
  }
}
